import requests
import json
import kkl_config


class Class:
    def __init__(self):
        self.url = kkl_config.URL_xhx + "/workbench/myclass/getteacherclasses"

    def getClassid(self,course_id,teacher_id):
        data = {
            "course_id": course_id,
            "teacher_id": teacher_id
        }
        cookies = {"xhxtoken":kkl_config.Token.xhxtoken}
        respone = requests.get(self.url, params=data, cookies=cookies)
        kkl_config.prints(respone)
        res = respone.json()
        print(json.dumps(res,ensure_ascii=False,indent=2))
        kkl_config.Variable.variable = str(res.get("data",).get("classes",)[0].get("id",))
        print("id:{}".format(kkl_config.Variable.variable))




if __name__ == "__main__":
    from login01 import LoginApi
    LoginApi().xhxLogin()
    Class().getClassid(105205,3367)
